import { getCouponList, getCouponByCondition, getCouponItem, createCoupon, copyCoupon, editCoupon, deleteCoupon } from '@/service/getData'
const state = {
  couponList : {
    list : [],
    page: {}
  },
  importList : {
    list: [],
    page: {}
  }
}
const actions = {
  async getCouponData({commit, state}, payload) {
    let res = await getCouponList(payload)
    state.couponList = res.data
    return res
  },
  async getByCondition({ commit, state }, payload) {
    let res = await getCouponByCondition(payload)
    return res
  },
  async getCouponOne({ commit, state }, payload) {
    let res = await getCouponItem(payload)
    return res
  },
  async createCouponItem({ commit, state }, payload) {
    let res = await createCoupon(payload)
    return res
  },
  async editCouponItem({ commit, state }, payload) {
    let res = await editCoupon(payload)
    return res
  },
  async delCouponItem({ commit, state }, payload) {
    let res = await deleteCoupon(payload)
    return res
  },
  async copyCouponItem({ commit, state }, payload) {
    let res = await copyCoupon(payload)
    return res
  }
}
export default {
  state,
  actions
}